package api

import (
	"api-getaway/basic/config"
	"api-getaway/handler/request"
	"api-getaway/model"
	"github.com/gin-gonic/gin"
	"net/http"
)

func AddressList(r *gin.Context) {
	var req request.Address
	err := r.ShouldBind(&req)
	if err != nil {
		r.JSON(http.StatusBadRequest, gin.H{
			"code":    400,
			"message": "参数错误",
			"data":    nil,
		})
		return
	}
	var all []model.Address
	config.DB.Debug().Find(&all)
	r.JSON(http.StatusOK, gin.H{
		"code":    200,
		"message": "地址列表展示成功",
		"data":    all,
	})
}
